Uitwisselprofiel IGJ Contextinformatie t.b.v. onaangekondigd inspectiebezoek

Over Uitwisselprofiel IGJ Contextinformatie t.b.v. onaangekondigd inspectiebezoek

1.2.0


Publicatiedatum:
27-10-2025

Inwerkingtreding:
27-10-2025

1.1.2. Wat is het aantal cliënten met een Wlz-indicatie per leveringsvorm en zorgprofiel?

Concepten

Relaties

Eigenschappen

SPARQL query

Code gekopieerd

...

Kopieer naar klembord

1# Indicator: IGJ 1.1.2
2# Parameters: ?vestigingsnummer, ?peildatum 
3# Ontologie: versie 3.0.0 of nieuwer
4 
5PREFIX onz-org: <http://purl.org/ozo/onz-org#>
6PREFIX onz-g:   <http://purl.org/ozo/onz-g#>
7PREFIX onz-pers:<http://purl.org/ozo/onz-pers#>
8PREFIX xsd:     <http://www.w3.org/2001/XMLSchema#>
9PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#>
10PREFIX onz-zorg:<http://purl.org/ozo/onz-zorg#>
11 
12SELECT ?zorgprofiel
13       (COUNT(DISTINCT ?client) AS ?Totaal)
14       (SUM(?is_verblijf_met_behandeling) AS ?verblijf_met_behandeling)
15       (SUM(?is_verblijf_zonder_behandeling) AS ?verblijf_zonder_behandeling)
16       (SUM(?is_pgb) AS ?pgb)
17       (SUM(?is_mpt) AS ?mpt)
18       (SUM(?is_vpt) AS ?vpt)
19       (SUM(?is_pgb_en_mpt) AS ?pgb_en_mpt)
20WHERE {
21  {
22    {
23      SELECT DISTINCT ?zorgprofiel
24      WHERE {
25        ?zorgprofiel a onz-zorg:ZorgProfiel .
26      }
27    }
28    OPTIONAL {
29      SELECT ?zorgprofiel ?client
30             ?is_verblijf_met_behandeling ?is_verblijf_zonder_behandeling
31             ?is_pgb ?is_mpt ?is_vpt ?is_pgb_en_mpt
32      WHERE {
33        {
34          # ---------- PER ZORGPROFIEL × CLIENT (aggregeer eerst 'any' flags) ----------
35          SELECT ?zorgprofiel ?client
36                 (MAX(?heeft_instelling_met_behandeling) AS ?is_verblijf_met_behandeling)
37                 (MAX(?heeft_instelling_zonder_behandeling) AS ?is_verblijf_zonder_behandeling)
38                 (MAX(?heeft_pgb_alleen) AS ?is_pgb)
39                 (MAX(?heeft_mpt_alleen) AS ?is_mpt)
40                 (MAX(?heeft_vpt) AS ?is_vpt)
41                 (MAX(xsd:integer(?heeft_pgb)) AS ?has_pgb_any)
42                 (MAX(xsd:integer(?heeft_mpt)) AS ?has_mpt_any)
43          WHERE {
44            #BIND("2024-01-12"^^xsd:date AS ?peildatum)
45            #BIND("000001254" AS ?target_vestigingsnummer)
46            BIND(?peildatum AS ?peildatum_argument)
47 
48            # Vestiging en zorgproces binnen peildatum
49            ?vestiging a onz-org:Vestiging ;
50                       onz-g:identifiedBy ?vestigingsnummer_object .
51            ?vestigingsnummer_object a onz-org:Vestigingsnummer ;
52                                     onz-g:hasDataValue ?vestigingsnummer .
53            #FILTER(?vestigingsnummer = ?target_vestigingsnummer)
54
55            ?zorgproces a onz-zorg:NursingProcess ;
56                        onz-g:definedBy ?indicatie ;
57                        onz-g:hasPerdurantLocation/onz-g:partOf* ?vestiging ;
58                        onz-g:startDatum ?start_zorgproces .
59            OPTIONAL { ?zorgproces onz-g:eindDatum ?eind_zorgproces }
60            FILTER(?peildatum_argument >= ?start_zorgproces &&
61                   (?peildatum_argument <= ?eind_zorgproces || !BOUND(?eind_zorgproces)))
62
63            # Indicatie binnen peildatum
64            ?indicatie a onz-zorg:WlzIndicatie ;
65                       onz-g:startDatum ?start_indicatie ;
66                       onz-zorg:heeftIndicatieBehandeling ?behandeling ;
67                       onz-g:isAbout ?client ;
68                       onz-g:isAbout ?zorgproces ;
69                       onz-g:hasPart ?leveringsvorm ;
70                       onz-g:hasPart ?zorgprofiel .
71            OPTIONAL { ?indicatie onz-g:eindDatum ?eind_indicatie }
72            FILTER(?peildatum_argument >= ?start_indicatie &&
73                   (?peildatum_argument <= ?eind_indicatie || !BOUND(?eind_indicatie)))
74
75            ?leveringsvorm a onz-zorg:Leveringsvorm .
76            ?zorgprofiel  a onz-zorg:ZorgProfiel .
77            ?client a onz-g:Human .
78
79            # Flags per indicatie
80            BIND(EXISTS { ?indicatie onz-g:hasPart onz-zorg:pgb }        AS ?heeft_pgb)
81            BIND(EXISTS { ?indicatie onz-g:hasPart onz-zorg:mpt }        AS ?heeft_mpt)
82            BIND(EXISTS { ?indicatie onz-g:hasPart onz-zorg:vpt }        AS ?heeft_vpt_check)
83            BIND(EXISTS { ?indicatie onz-g:hasPart onz-zorg:instelling } AS ?heeft_instelling)
84
85            # Categorieën per indicatie
86            BIND(IF(?leveringsvorm = onz-zorg:instelling && ?behandeling, 1, 0) AS ?heeft_instelling_met_behandeling)
87            BIND(IF(?leveringsvorm = onz-zorg:instelling && !?behandeling, 1, 0) AS ?heeft_instelling_zonder_behandeling)
88            BIND(IF(?heeft_pgb && !?heeft_mpt, 1, 0) AS ?heeft_pgb_alleen)
89            BIND(IF(?heeft_mpt && !?heeft_pgb, 1, 0) AS ?heeft_mpt_alleen)
90            BIND(IF(?heeft_vpt_check, 1, 0) AS ?heeft_vpt)
91          }
92          GROUP BY ?zorgprofiel ?client
93        }
94        # ---------- combinatie na aggregatie ----------
95        BIND(IF(?has_pgb_any = 1 && ?has_mpt_any = 1, 1, 0) AS ?is_pgb_en_mpt)
96      }
97    }
98  }
99  UNION
100  {
101    VALUES ?zorgprofiel { "Totaal uniek aantal clienten" }
102    OPTIONAL {
103      {
104        # ---------- Alle kolommen per cliënt (zoals eerder), zónder pgb_en_mpt ----------
105        SELECT DISTINCT ?client
106               ?is_verblijf_met_behandeling ?is_verblijf_zonder_behandeling
107               ?is_pgb ?is_mpt ?is_vpt ?is_pgb_en_mpt
108        WHERE {
109          {
110            SELECT ?client
111                   (MAX(?heeft_instelling_met_behandeling) AS ?is_verblijf_met_behandeling)
112                   (MAX(?heeft_instelling_zonder_behandeling) AS ?is_verblijf_zonder_behandeling)
113                   (MAX(?heeft_pgb_alleen) AS ?is_pgb)
114                   (MAX(?heeft_mpt_alleen) AS ?is_mpt)
115                   (MAX(?heeft_vpt) AS ?is_vpt)
116            WHERE {
117              #BIND("2024-01-12"^^xsd:date AS ?peildatum)
118              #BIND("000001254" AS ?target_vestigingsnummer)
119              BIND(?peildatum AS ?peildatum_argument)
120 
121              ?vestiging a onz-org:Vestiging ;
122                         onz-g:identifiedBy ?vestigingsnummer_object .
123              ?vestigingsnummer_object a onz-org:Vestigingsnummer ;
124                                       onz-g:hasDataValue ?vestigingsnummer .
125              #FILTER(?vestigingsnummer = ?target_vestigingsnummer)
126
127              ?zorgproces a onz-zorg:NursingProcess ;
128                          onz-g:definedBy ?indicatie ;
129                          onz-g:hasPerdurantLocation/onz-g:partOf* ?vestiging ;
130                          onz-g:startDatum ?start_zorgproces .
131              OPTIONAL { ?zorgproces onz-g:eindDatum ?eind_zorgproces }
132              FILTER(?peildatum_argument >= ?start_zorgproces &&
133                     (?peildatum_argument <= ?eind_zorgproces || !BOUND(?eind_zorgproces)))
134
135              ?client a onz-g:Human .
136              ?indicatie a onz-zorg:WlzIndicatie ;
137                         onz-g:startDatum ?start_indicatie ;
138                         onz-zorg:heeftIndicatieBehandeling ?behandeling ;
139                         onz-g:isAbout ?client ;
140                         onz-g:isAbout ?zorgproces ;
141                         onz-g:hasPart ?leveringsvorm ;
142                         onz-g:hasPart ?zorgprofiel_i .
143              OPTIONAL { ?indicatie onz-g:eindDatum ?eind_indicatie }
144              FILTER(?peildatum_argument >= ?start_indicatie &&
145                     (?peildatum_argument <= ?eind_indicatie || !BOUND(?eind_indicatie)))
146
147              ?leveringsvorm a onz-zorg:Leveringsvorm .
148              ?zorgprofiel_i a onz-zorg:ZorgProfiel .
149
150              # per-indicatie flags
151              BIND(EXISTS { ?indicatie onz-g:hasPart onz-zorg:pgb }        AS ?heeft_pgb)
152              BIND(EXISTS { ?indicatie onz-g:hasPart onz-zorg:mpt }        AS ?heeft_mpt)
153              BIND(EXISTS { ?indicatie onz-g:hasPart onz-zorg:vpt }        AS ?heeft_vpt_check)
154              BIND(EXISTS { ?indicatie onz-g:hasPart onz-zorg:instelling } AS ?heeft_instelling)
155
156              BIND(IF(?leveringsvorm = onz-zorg:instelling && ?behandeling, 1, 0) AS ?heeft_instelling_met_behandeling)
157              BIND(IF(?leveringsvorm = onz-zorg:instelling && !?behandeling, 1, 0) AS ?heeft_instelling_zonder_behandeling)
158              BIND(IF(?heeft_pgb && !?heeft_mpt, 1, 0) AS ?heeft_pgb_alleen)
159              BIND(IF(?heeft_mpt && !?heeft_pgb, 1, 0) AS ?heeft_mpt_alleen)
160              BIND(IF(?heeft_vpt_check, 1, 0) AS ?heeft_vpt)
161            }
162            GROUP BY ?client
163          }
164
165          # ---------- Specifiek pgb_en_mpt: per client × zorgprofiel combineren, daarna per client ----------
166          OPTIONAL {
167            {
168              SELECT ?client (MAX(?combo_zp) AS ?combo_any)
169              WHERE {
170                SELECT ?client ?zp
171                       (MAX(xsd:integer(?heeft_pgb)) AS ?has_pgb_any_zp)
172                       (MAX(xsd:integer(?heeft_mpt)) AS ?has_mpt_any_zp)
173                       (IF( (MAX(xsd:integer(?heeft_pgb)) = 1) && (MAX(xsd:integer(?heeft_mpt)) = 1), 1, 0) AS ?combo_zp)
174                WHERE {
175                  #BIND("2024-01-12"^^xsd:date AS ?peildatum)
176                  #BIND("000001254" AS ?target_vestigingsnummer)
177                  BIND(?peildatum AS ?peildatum_argument)
178
179                  ?vestiging a onz-org:Vestiging ;
180                             onz-g:identifiedBy ?vestigingsnummer_object .
181                  ?vestigingsnummer_object a onz-org:Vestigingsnummer ;
182                                           onz-g:hasDataValue ?vestigingsnummer .
183                  #FILTER(?vestigingsnummer = ?target_vestigingsnummer)
184
185                  ?zorgproces a onz-zorg:NursingProcess ;
186                              onz-g:definedBy ?indicatie ;
187                              onz-g:hasPerdurantLocation/onz-g:partOf* ?vestiging ;
188                              onz-g:startDatum ?start_zorgproces .
189                  OPTIONAL { ?zorgproces onz-g:eindDatum ?eind_zorgproces }
190                  FILTER(?peildatum_argument >= ?start_zorgproces &&
191                         (?peildatum_argument <= ?eind_zorgproces || !BOUND(?eind_zorgproces)))
192
193                  ?client a onz-g:Human .
194                  ?indicatie a onz-zorg:WlzIndicatie ;
195                             onz-g:startDatum ?start_indicatie ;
196                             onz-g:isAbout ?client ;
197                             onz-g:isAbout ?zorgproces ;
198                             onz-g:hasPart ?lv ;
199                             onz-g:hasPart ?zp .
200                  OPTIONAL { ?indicatie onz-g:eindDatum ?eind_indicatie }
201                  FILTER(?peildatum_argument >= ?start_indicatie &&
202                         (?peildatum_argument <= ?eind_indicatie || !BOUND(?eind_indicatie)))
203
204                  ?lv a onz-zorg:Leveringsvorm .
205                  ?zp a onz-zorg:ZorgProfiel .
206
207                  BIND(EXISTS { ?indicatie onz-g:hasPart onz-zorg:pgb } AS ?heeft_pgb)
208                  BIND(EXISTS { ?indicatie onz-g:hasPart onz-zorg:mpt } AS ?heeft_mpt)
209                }
210                GROUP BY ?client ?zp
211              }
212              GROUP BY ?client
213            }
214            BIND(COALESCE(?combo_any, 0) AS ?is_pgb_en_mpt)
215          }
216        }
217      }
218    }
219  }
220}   
221GROUP BY ?zorgprofiel
222ORDER BY ?zorgprofiel
223